package com.milks.controller.admin;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;

import com.milks.bean.ProductImage;

public class BusinessDeal {
	/*
	 * 根据post参数传递过来的上传文件的参数，生成一个存放商品图片的一个List
	 * 
	 */
	public static List<ProductImage> getProductImageList(HttpServletRequest request,String uploadPicPathParams ) {
		
		/*String[] uploadPicPath =  request.getParameterValues("uploadPicPath");
		List<ProductImage> productImageList = new ArrayList<ProductImage>();
		for (String item : uploadPicPath) {
			ProductImage image = new ProductImage();
			image.setSourceProductImagePath(item);
			productImageList.add(image);
		}*/
		String[] uploadPicPath =  request.getParameterValues(uploadPicPathParams);
		List<ProductImage> productImageList = new ArrayList<ProductImage>();
		if (uploadPicPath!=null) {
			for (String item : uploadPicPath) {
				ProductImage image = new ProductImage();
				if (item.isEmpty()) {
					continue;
				}
				image.setSourceProductImagePath(item);
				productImageList.add(image);
			}
		}
		return productImageList;
	}
}
